<?php 
	session_start();
	require_once("../includes/public.inc.php");
	$type = isset($_GET['type'])?$_GET['type']:'';
	$id = isset($_GET['id'])?$_GET['id']:0;
	$username = isset($_SESSION['username'])?$_SESSION['username']:'';
	if (empty($username))
	{
		echo "<script>alert('亲你还没有登录哦');history.back();</script>";	exit;
	}
	$pr = mysql_fetch_array(mysql_query("select * from ".DBQIAN."gift where id=".$id." order by id desc limit 1"));
	if ($pr['status'] == 0)
	{
		echo "<script>alert('亲！活动已经过期哦！下次再来吧，更多活动请关注我们的微信公众号！');history.back(-1);</script>";	exit;
	}
	if ($pr)
	{
		$getway = mysql_fetch_array(mysql_query("select * from ".DBQIAN."post where id=".$pr['getway']." order by id desc limit 1"));
	}
?>
<!DOCTYPE html PUBLIC "-//WAPFORUM//DTD XHTML Mobile 1.0//EN" "http://www.wapforum.org/DTD/xhtml-mobile10.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="viewport" content="user-scalable=yes, width=device-width, initial-scale=1.0, maximum-scale=1.0">
<title>礼品详情</title>
<link rel="stylesheet" type="text/css" href="css/huanqu.css" media="all">
</head>
<body>
	<div class="pz-css">
		<ul class="top-tool">
			<li class="title">礼品详情</li>
			<li class="back"><a href="javascript:history.go(-1)"></a>
			</li><li class="home"><a href="index.php?type=<?=$_GET['type']?>"></a></li>
		</ul>
		<?if ($pr['id']==4):?>
			<div class="pz-panel">
				<img style="width: 100%;" src="<?=$pr['img']?>" />
			</div>
			<div class="pz-panel">
				<div class="group">
					<h4><?=$pr['name']?></h4>
					<h5>兑换方式：<?='直接领取'?></h5>
					<h5>所需积分：<span style="color: rgb(255, 0, 0);"><?=$pr['credit']?></span></h5>
				</div>
				<div class="group">
					<h5>兑换数量：<input value="1" min="1" max="10000" style="width: 68px;" id="txtQty" name="txtQty" type="number" /></h5>
				</div>
	            <input name="productname" value="<?=$pr['name']?>" type="hidden" />
	            <input name="productlx" value="<?=$pr['getway']?>" type="hidden" />
				<div class="group">
					<div class="span6">
						<button type="button" onclick="location.href='creditshop.php?type=<?=$type?>'">返回</button>
					</div>
					<div class="span6">
						<button class="red" onclick="location.href='hylinghongbao.php?type=<?=$type?>'">立即兑换</button>
					</div>
				</div>
			</div>
			 <div class="pz-panel">
				<div class="group">
		            <h5><?='直接领取'?>的兑换细则:</h5>
					<h4><?='本奖品为直接兑换，本次活动扣取的分数不再退还！'?></h4>
				</div>
			</div>
		<?elseif ($pr['id']==3):?>
			<div class="pz-panel">
				<img style="width: 100%;" src="<?=$pr['img']?>" />
			</div>
			<div class="pz-panel">
				<div class="group">
					<h4><?=$pr['name']?></h4>
					<h5>兑换方式：<?='直接领取'?></h5>
					<h5>所需积分：<span style="color: rgb(255, 0, 0);"><?=$pr['credit']?></span></h5>
				</div>
				<div class="group">
					<h5>兑换数量：<input value="1" min="1" max="10000" style="width: 68px;" id="txtQty" name="txtQty" type="number" /></h5>
				</div>
	            <input name="productname" value="<?=$pr['name']?>" type="hidden" />
	            <input name="productlx" value="<?=$pr['getway']?>" type="hidden" />
				<div class="group">
					<div class="span6">
						<button type="button" onclick="location.href='creditshop.php?type=<?=$type?>'">返回</button>
					</div>
					<div class="span6">
						<button class="red" onclick="location.href='ticketbonus.php?type=<?=$type?>'">立即兑换</button>
					</div>
				</div>
			</div>
			 <div class="pz-panel">
				<div class="group">
		            <h5><?='直接领取'?>的兑换细则:</h5>
					<h4><?='本奖品为直接兑换，本次活动扣取的分数不再退还！'?></h4>
				</div>
			</div>
		<?else:?>
		<form action="addressedit.php?act=dui&id=<?=$pr['id']?>&type=<?=$type?>" id="frm" method="post">
			<div class="pz-panel">
				<img style="width: 100%;" src="<?=$pr['img']?>" />
			</div>
			<div class="pz-panel">
				<div class="group">
					<h4><?=$pr['name']?></h4>
					<h5>兑换方式：<?=$getway['name']?></h5>
					<h5>所需积分：<span style="color: rgb(255, 0, 0);"><?=$pr['credit']?></span></h5>
				</div>
				<div class="group">
					<h5>兑换数量：<input value="1" min="1" max="10000" style="width: 68px;" id="txtQty" name="txtQty" type="number" /></h5>
				</div>
	            <input name="productname" value="<?=$pr['name']?>" type="hidden" />
	            <input name="productlx" value="<?=$pr['getway']?>" type="hidden" />
				<div class="group">
					<div class="span6">
						<button type="button" onclick="location.href='creditshop.php?type=<?=$type?>'">返回</button>
					</div>
					<div class="span6">
						<button class="red">立即兑换</button>
					</div>
				</div>
			</div>
		</form>
	    <div class="pz-panel">
			<div class="group">
	            <h5><?=$getway['name']?>的兑换细则:</h5>
				<h4><?=$getway['desc']?></h4>
			</div>
		</div>
		<?endif;?>
	</div>
</body>
</html>